package com.jspgou.cms.entity;

import com.jspgou.cms.entity.base.BaseStoreCategory;
import com.jspgou.common.hibernate3.HibernateTree;
import com.jspgou.common.hibernate3.PriorityInterface;



public class StoreCategory extends BaseStoreCategory implements HibernateTree,
       PriorityInterface {
	private static final long serialVersionUID = 1L;

/*[CONSTRUCTOR MARKER BEGIN]*/
	public StoreCategory () {
		super();
	}

	/**
	 * Constructor for primary key
	 */
	public StoreCategory (java.lang.Long id) {
		super(id);
	}

	/**
	 * Constructor for required fields
	 */
	public StoreCategory (
		java.lang.Long id,
		com.jspgou.cms.entity.Store store,
		com.jspgou.core.entity.Website website,
		java.lang.Integer lft,
		java.lang.Integer rgt,
		java.lang.Integer priority) {

		super (
			id,
			store,
			website,
			lft,
			rgt,
			priority);
	}

/*[CONSTRUCTOR MARKER END]*/
	
	/**
	 * 每个站点各自维护独立的树结构
	 * 
	 * @see HibernateTree#getTreeCondition()
	 */
	public String getTreeCondition() {
		return "bean.website.id=" + getWebsite().getId();
	}

	/**
	 * @see HibernateTree#getParentId()
	 */
	public Long getParentId() {
		StoreCategory parent = getParent();
		if (parent != null) {
			return parent.getId();
		} else {
			return null;
		}
	}
	
	/**
	 * @see HibernateTree#getLftName()
	 */
	public String getLftName() {
		return DEF_LEFT_NAME;
	}

	/**
	 * @see HibernateTree#getParentName()
	 */
	public String getParentName() {
		return DEF_PARENT_NAME;
	}

	/**
	 * @see HibernateTree#getRgtName()
	 */
	public String getRgtName() {
		return DEF_RIGHT_NAME;
	}


}